﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Viewer.BusinessObject.BusinessEntities;
using Ext.Net;
namespace Viewer.NhomNguoiDung
{
    public partial class NhomNguoiDung : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LoadData();
            }
        }

        public void LoadData()
        {
            storeNhomNguoiDung.DataSource = (new QUNhomNguoiDung()).GetAll();
            storeNhomNguoiDung.DataBind();
        }

        protected void btnAddNew_Click(object sender, DirectEventArgs e)
        {
            winUCNhomNguoiDung.ShowDialogAddNew();
        }
        [DirectMethod]
        public void ShowDialogEdit(int pNguoiDungID)
        {
            winUCNhomNguoiDung.ShowDialogEdit(pNguoiDungID);
        }
        [DirectMethod]
        public void ShowDialogDetail(int pNguoiDungID)
        {
            winUCNhomNguoiDung.ShowDialogDetail(pNguoiDungID);
        }
        [DirectMethod]
        public void Delete(int pNguoiDungID)
        {
            var oItem = (new QUNhomNguoiDung()).GetByID(pNguoiDungID);
            oItem.Delete();
            LoadData();
        }


    }
}
